package day05.sub;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @title: A
 * @author: lbj
 * @date: 2022/5/3 9:42 上午
 * @description: TODO 类描述
 */

//解决构造方法循环依赖问题
//第四种 @Scope
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
@Component
class B {
    private static final Logger log = LoggerFactory.getLogger("B");
    private A a;

    public B(A a){
        log.debug("B(A a) {}",a.getClass());
        this.a = a;
    }

    @PostConstruct
    public void init(){
        log.debug("B init()");
    }

}
